Skip to main content

normalizeText

Type

function

Summary

Converts a text string into a specific 'normal form'.

Syntax

normalizeText(<text>, <normalForm>)

Description

Use the normalizeText function when you require a specific normal form of text.

Normalization is a process defined by the Unicode standard for removing minor encoding differences for a small set of characters. In Unicode text, the same visual string can be represented by different character sequences. A prime example of this is precomposed characters and decomposed characters: an "e" followed by a combining acute character is visually indistinguishable from a precombined "é" character. Because of the confusion that can result, Unicode defined a number of "normal forms" that ensure that character representations are consistent. The "compatibility" normal forms are designed by the Unicode Consortium for dealing with certain legacy encodings and are not generally useful otherwise.

note

Normalization does not avoid all problems with visually-identical characters; Unicode contains a number of characters that will (in the majority of fonts) be indistinguishable but are nonetheless completely different characters (a prime example of this is M and U+2164 ROMAN NUMERAL ONE THOUSAND).

Unless the formSensitive property is set to true, LiveCode ignores text normalization when performing comparisons.

Parameters

NameTypeDescription

text

string

normalForm

enum

Examples

local tExample
set the formSensitive to true
put "e" & numToCodepoint("0x301") into tExample -- Acute accent
put tExample is "é" -- Returns false
put normalizeText(tExample, "NFC") is "é" -- Returns true

glossary: property, Unicode

property: formSensitive

function: textDecode, textEncode

Compatibility and Support

Introduced

LiveCode 7.0

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?